import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter);

const routes = [
    {
        path: '/expressway', component: () => import('@/views/expressway-service/expressway.vue'),
    },
    {
        path: '/post-deployment', component: () => import('@/views/expressway-service/post-deployment.vue'),
    },{
        path: '/police-deployment', component: () => import('@/views/expressway-service/police-deployment.vue'),
    },{
        path: '/getWayCoordinate', component: () => import('@/views/common/getWayCoordinate.vue'),
    },
    {path: '/login', component: () => import('@/views/common/login.vue')},
    {path: '/register', component: () => import('@/views/common/register.vue')},
    {path: '/404', component: () => import('@/views/common/404.vue')},
    {path: '*', redirect: "/police-deployment"},
];

const router = new VueRouter({
    routes
});
// 前置全局钩子
router.beforeEach((to, from, next) => {
    // console.log(to);
    // console.log(from);
    // setTimeout(function(){
    // },2000)
    next()

})

export default router
